
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title></title>
<script type="text/javascript" src="http://www.jq22.com/demo/jquery-loading20151112/js/prefixfree.min.js"></script>
<style>
body {
  background-color: #f5f7f9;
  color: #6c6c6c;
  font: 300 1em/1.5em;
}
.container {
  left: 50%;
  position: absolute;
  top: 100px;
  transform: translate(-50%, -50%);
}

/* PROGRESS */
.progress {
  background-color: #e5e9eb;
  height: 0.25em;
  position: relative;
  width: 24em;
}
.progress-bar {
  animation-duration: 3s;
  animation-name: width;
  background-image: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);
  background-size: 24em 0.25em;
  height: 100%;
  position: relative;
  height: 8px;
}
.progress-shadow {
  background-image: linear-gradient(to bottom, #ffffff, transparent);
  height: 4em;
  position: absolute;
  top: 100%;
  transform: skew(45deg);
  transform-origin: 0 0;
  width: 100%;
}

/* ANIMATIONS */
@keyframes width {
  0%, 100% {
    transition-timing-function: cubic-bezier(1, 0, 0.65, 0.85);
  }
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}
</style>
</head>
<body>
<!-- 代码 开始 -->
<div class="container">
	<div class="progress">
		<div class="progress-bar">
			<div class="progress-shadow"></div>
		</div>
	</div>
</div>
<!-- 代码 结束 -->

</body>
</html>
<!--公共方法-->
<script type="text/javascript" src="js/module/utilModule.js" ></script> 
<!--配置信息-->
<script type="text/javascript" src="js/common/config.js"></script>
<script type="text/javascript" src="js/lib/zepto.min.js" ></script>

<!--自定义模块-->
<script type="text/javascript" src="js/module/homepageModule.js" ></script>
<script type="text/javascript" src="js/homepage/homepage.js" ></script>
<script language='javascript' src='./js/lib/IM/webim.config.js'></script>
<script language='javascript' src='./js/lib/IM/strophe-1.2.8.min.js'></script>
<script language='javascript' src='./js/lib/IM/websdk-1.4.12.js'></script>
<script type="text/javascript" src="./js/lib/IM/ImUtilModule.js"></script>
<script>

  $(function() {

  	//获取 doctorid
    var doctorid = utilModule.getQueryString("doctorid")?utilModule.getQueryString("doctorid"):alert("未知医生");
    var orderType = utilModule.getQueryString("orderType")?utilModule.getQueryString("orderType"):alert("未知订单类型");
    var orderid = utilModule.getQueryString("orderid")?utilModule.getQueryString("orderid"):alert("未知订单ID");
    var msg = utilModule.getQueryString("msg")?utilModule.getQueryString("msg"):alert("msg异常");
    var ext = utilModule.getQueryString("ext")?utilModule.getQueryString("ext"):1;
    var params = {};
    params.doctorId=doctorid;
      utilModule.post({
          url: "doctor/doctorDetail",
          data: params,
          needJson: false, 
          async: false,
          success: function (response) {
              alert("连接成功");
              console.log(response);
              response.doctor
              var doctorInfo = response.doctor;
              var doctorObject = {};
              doctorObject.doctorid = doctorInfo.id;
              var usernameIM = DOCTOR_IM_PREFFIX+doctorInfo.id;
              doctorObject.usernameIM = usernameIM;
              doctorObject.avatar = doctorInfo.avatar;
              doctorObject.realname = doctorInfo.realname;
              doctorObject.deptName=doctorInfo.deptName;
              utilModule.setStorage(usernameIM, JSON.stringify(doctorObject));

              console.log("医生信息:" + utilModule.getStorage(usernameIM));
              
              //清空与该医生之前的聊天记录
              var chatList=utilModule.getStorage("chat_list");
              if(chatList!=null){
                 var  chatObject=JSON.parse(chatList);
                 
                 var rd_key=DOCTOR_IM_PREFFIX+doctorInfo.id;
                 if(typeof(chatObject[rd_key])!="undefined"){ 
                   if(chatObject[rd_key].length == 20){
                      delete chatObject[rd_key];
                  
                      var  $chatObject=JSON.stringify(chatObject);
                   
                      utilModule.setStorage("chat_list",$chatObject);
                   }
                }
                 
                
              }
              //支付成功跳转im聊天界面 payStatus: 1:付费咨询  0:免费咨询
              location.replace("./html/inquiry/inquiry-service.html?usernameIM=" + usernameIM+"&orderid="+orderid+"&payStatus="+orderType+"&doctorid="+doctorInfo.id+"&msg="+utilModule.decodeURIComponent("msg")+"&ext="+ext);
          }
      });
  })
  </script>